import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:znmm/UI/A_Common/custom_web_view.dart';
import 'package:znmm/UI/utils/my_global.dart';
import 'package:znmm/config/app_color.dart';
import 'package:url_launcher/url_launcher.dart';

class CnAboutUsView extends StatefulWidget {
  const CnAboutUsView({super.key});

  @override
  State<CnAboutUsView> createState() => _CnAboutUsViewState();
}

class _CnAboutUsViewState extends State<CnAboutUsView> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColor.backgroundColor,
      appBar: MyGlobal.getNavigationBar(
        context,
        "About Us",
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
              margin: const EdgeInsets.fromLTRB(10, 8, 10, 0),
              decoration: BoxDecoration(
                  color: Colors.grey.withOpacity(0.1),
                  borderRadius: BorderRadius.circular(10.r)),
              child: ListTile(
                leading: const Icon(
                  Icons.phone,
                ),
                title: GestureDetector(
                  onTap: () {
                    _makePhoneCall("+8613867702475");
                  },
                  child: const Text(
                    "+86 13867702475",
                    style: TextStyle(fontSize: 16.0),
                  ),
                ),
                //onTap: () async {},
              )),
          Container(
            margin: const EdgeInsets.fromLTRB(10, 8, 10, 0),
            decoration: BoxDecoration(
                color: Colors.grey.withOpacity(0.1),
                borderRadius: BorderRadius.circular(10.r)),
            child: const ListTile(
              leading: Icon(Icons.email_outlined),
              title: Text(
                "001@mikeeyewear.com",
                style: TextStyle(fontSize: 16.0),
              ),
              //onTap: () async {},
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(10, 8, 10, 0),
            decoration: BoxDecoration(
                color: Colors.grey.withOpacity(0.1),
                borderRadius: BorderRadius.circular(10.r)),
            child: ListTile(
              leading: const Icon(Icons.contacts),
              title: const Text(
                "About-us",
                style: TextStyle(fontSize: 16.0),
              ),
              trailing: const Icon(Icons.arrow_right),
              onTap: () async {
                Get.to(const CustomWebView(
                  titleStr: "About-us",
                  initialUrl: "https://www.glassesin.com/about-us",
                ));
              },
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(10, 8, 10, 0),
            decoration: BoxDecoration(
                color: Colors.grey.withOpacity(0.1),
                borderRadius: BorderRadius.circular(10.r)),
            child: ListTile(
              leading: const Icon(Icons.contacts),
              title: const Text(
                "Contact-us",
                style: TextStyle(fontSize: 16.0),
              ),
              trailing: const Icon(Icons.arrow_right),
              onTap: () async {
                Get.to(const CustomWebView(
                  titleStr: "Contact-us",
                  initialUrl: "https://www.glassesin.com/contact",
                ));
              },
            ),
          ),
        ],
      ),
    );
  }

  Future<void> _makePhoneCall(String phoneNumber) async {
    final Uri telUri = Uri(scheme: 'tel', path: phoneNumber);
    if (await canLaunchUrl(telUri)) {
      await launchUrl(telUri);
    } else {
      print("无法拨打电话 $phoneNumber");
    }
  }
}
